﻿using System;
using System.Collections.Generic;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.nodes.mdx;

namespace SharpSqlAnalyzer.stmt.mdx
{
	// Token: 0x020001A5 RID: 421
	public class TMdxSelect : TCustomSqlStatement
	{
		// Token: 0x06000E40 RID: 3648 RVA: 0x00309C8D File Offset: 0x00307E8D
		public TMdxSelect(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstmdxselect;
		}

		// Token: 0x06000E41 RID: 3649 RVA: 0x00309CA4 File Offset: 0x00307EA4
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			this.selectNode = (TMdxSelectNode)this.rootNode;
			if (this.selectNode.SubQuery != null)
			{
				this.subQuery = new TMdxSelect(EDbVendor.dbvmdx);
				this.subQuery.rootNode = this.selectNode.SubQuery;
				this.subQuery.doParseStatement(this);
			}
			return 0;
		}

		// Token: 0x17000296 RID: 662
		// (get) Token: 0x06000E42 RID: 3650 RVA: 0x00309D12 File Offset: 0x00307F12
		public virtual List<TMdxWithNode> Withs
		{
			get
			{
				return this.selectNode.Withs;
			}
		}

		// Token: 0x17000297 RID: 663
		// (get) Token: 0x06000E43 RID: 3651 RVA: 0x00309D1F File Offset: 0x00307F1F
		public virtual List<TMdxAxisNode> Axes
		{
			get
			{
				return this.selectNode.Axes;
			}
		}

		// Token: 0x17000298 RID: 664
		// (get) Token: 0x06000E44 RID: 3652 RVA: 0x00309D2C File Offset: 0x00307F2C
		public virtual TMdxIdentifierNode Cube
		{
			get
			{
				return this.selectNode.Cube;
			}
		}

		// Token: 0x17000299 RID: 665
		// (get) Token: 0x06000E45 RID: 3653 RVA: 0x00309D39 File Offset: 0x00307F39
		public virtual TMdxSelect SubQuery
		{
			get
			{
				return this.subQuery;
			}
		}

		// Token: 0x1700029A RID: 666
		// (get) Token: 0x06000E46 RID: 3654 RVA: 0x00309D41 File Offset: 0x00307F41
		public virtual TMdxWhereNode Where
		{
			get
			{
				return this.selectNode.Where;
			}
		}

		// Token: 0x1700029B RID: 667
		// (get) Token: 0x06000E47 RID: 3655 RVA: 0x00309D4E File Offset: 0x00307F4E
		public virtual List<TMdxExpNode> CellProps
		{
			get
			{
				return this.selectNode.CellProps;
			}
		}

		// Token: 0x06000E48 RID: 3656 RVA: 0x00309D5B File Offset: 0x00307F5B
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000E49 RID: 3657 RVA: 0x00309D6C File Offset: 0x00307F6C
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.Withs != null)
			{
				foreach (TMdxWithNode tmdxWithNode in this.Withs)
				{
					tmdxWithNode.acceptChildren(v);
				}
			}
			if (this.Axes != null)
			{
				foreach (TMdxAxisNode tmdxAxisNode in this.Axes)
				{
					tmdxAxisNode.acceptChildren(v);
				}
			}
			if (this.SubQuery != null)
			{
				this.SubQuery.acceptChildren(v);
			}
			else if (this.Cube != null)
			{
				this.Cube.acceptChildren(v);
			}
			if (this.Where != null)
			{
				this.Where.acceptChildren(v);
			}
			if (this.CellProps != null)
			{
				foreach (TMdxExpNode tmdxExpNode in this.CellProps)
				{
					tmdxExpNode.acceptChildren(v);
				}
			}
			v.postVisit(this);
		}

		// Token: 0x0400132C RID: 4908
		private TMdxSelectNode selectNode;

		// Token: 0x0400132D RID: 4909
		private TMdxSelect subQuery;
	}
}
